package com.wm.walmart.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import com.wm.walmart.entity.DepartmentUser;
import com.wm.walmart.service.IDepartmentUserService;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author xieyize
 * @since 2019-12-09
 */
@RestController
@RequestMapping("/departmentUser/")
public class DepartmentUserController {
	@Resource
	private IDepartmentUserService deptUserService;
	
	/**
	 * 添加部门id与对应用户id
	 * http://localhost:8080/walmart/departmentUser/insertDeptUser?uId=1&dptId=2
	 */
	@RequestMapping("insertDeptUser")
	public Object insertDeptUser(DepartmentUser deptUser) {
		return deptUserService.save(deptUser);
	}
	/**
	 * 根据部门用户id修改该id下部门id与对应用户id
	 * http://localhost:8080/walmart/departmentUser/updateDeptUser?dptuId=7&uId=1&dptId=3
	 */
	@RequestMapping("updateDeptUser")
	public Object updateDeptUser(DepartmentUser deptUser) {
		return deptUserService.updateById(deptUser);
	}
	/**
	 * 根据部门用户id删除该id下部门用户信息
	 * http://localhost:8080/walmart/departmentUser/deleteDeptUserById?dptuId=7
	 */
	@RequestMapping("deleteDeptUserById")
	public Object deleteDeptUserById(Integer dptuId) {
		return deptUserService.removeById(dptuId);
	}
}
